package com.hylu.springcloud.controller;

import com.hylu.springcloud.dto.BookDTO;
import com.hylu.springcloud.services.EchoService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DubboSampleController {
    @DubboReference
    private EchoService echoService;

    @GetMapping("/echo")
    public String echo(String message) {
        return echoService.echo(message);
    }

    @PostMapping("/addBook")
    public BookDTO add(BookDTO bookDTO) {
        return echoService.add(bookDTO);
    }
}
